﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataAccess;
using DataAccess.Exceptions;
using Model;

namespace Business.WPF
{
    public  class SearchInscriptionManager
    {
        public Collection<Inscription> SearchInscriptionByStudentId(int id)
        {
            try
            {
                if (String.IsNullOrEmpty(id.ToString()))

                    return null;//  return InscriptionDataAccess.GetAllStudents();
                else
                    return InscriptionDataAccess.GetInscriptionByStudentID(id);
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error: " + ex.Message);
            }
        }

        public Collection<Inscription> SearchInscriptionByStudentName(string name)
        {
            try
            {
                if (String.IsNullOrEmpty(name))
                    return null;
                else
                    return InscriptionDataAccess.GetInscriptionByStudentName(name);
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error: " + ex.Message);
            }
        }
        public Collection<Inscription> SearchInscriptionBySubjectname(string subjectName)
        {
            try
            {
                if (String.IsNullOrEmpty(subjectName))
                    return null;
                else
                    return InscriptionDataAccess.GetInscriptionBySubjectname(subjectName);
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error: " + ex.Message);
            }
        }
        public Collection<Inscription> SearchInscriptionBySubjectSigla(string subjectSigla)
        {
            try
            {
                if (String.IsNullOrEmpty(subjectSigla))
                    return null;
                else
                    return InscriptionDataAccess.GetInscriptionBySubjectSigla(subjectSigla);
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error: " + ex.Message);
            }
        }
        public Collection<Inscription> SearchInscriptionBySubjectCode(long subjectCode)
        {
            try
            {
                if (String.IsNullOrEmpty(subjectCode.ToString()))
                    return null;
                else
                    return InscriptionDataAccess.GetInscriptionBySubjectCode(subjectCode);
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error: " + ex.Message);
            }
        }
       

    }
}
